#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main() {
	int n, k;
	string s;
	cin >> n >> k;
	cin >> s;

	map<string, int> mp;

	for (int i = 0; i <= n - k; i++) {
		mp[s.substr(i, k)]++;
	}

	int ans = INT_MIN;
	for (auto & [key, value] : mp) {
		if (value > ans) ans = value;
	}

	cout << ans << endl;

	for (auto & [key, value] : mp) {
		if (value == ans) {
			cout << key << " ";
		}
	}

	cout <<  endl;
}